/**
 * @see https://umijs.org/docs/max/access#access
 * */
export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {
  const { currentUser } = initialState ?? {};
  const userAccess = currentUser?.sysRoleList.map((i) => i.roleKey);
  return {
    canAdmin: currentUser && userAccess.includes('admin'),
  };
}
